平方序列
题目 平方序列
思路分析
直接枚举就行了
代码实现
#include<bits/stdc++.h>
using namespace std;
#define endl '\n'
int res=1e6;
int main()
{
ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);
for(int x=2019+1;x<100000;x++){
for(int y=x+1;y<100000;y++){
if(2*x*x==2019*2019+y*y){
res=min(res,x+y);
}
}
}
cout<<res; //7020
return 0;
}
同类题型
视频讲解
⬅️ 第十届蓝桥杯大赛软件赛决赛C/C++ 大学 B 组 🏠 00-冲刺国赛 ➡️ 质数拆分
💬 评论